#include <iostream>
#include "string.h"
using namespace std;

void swap(void *x, void *y,const size_t size) {
    char tmp[size];
    memcpy(tmp,y,size);
    memcpy(y,x,size);
    memcpy(x,tmp,size);
}

int main()
{
    int x = 1;
    int y = 2;
    swap(&x,&y,sizeof (int));
    cout << x << y << endl;

//    char *str1 = "abc";
//    char *str2 = "def";
//    swap(&str1,&str2,sizeof (str1));
//    cout << str1 << str2 << endl;
    return 0;
}
